<?php
namespace Plugin\Attractions\Commerce\Schema\Commerce_address;

use Plugin\Attractions\Commerce\Model\Commerce_address\CommerceAddress;
use Hyperf\Swagger\Annotation\Property;
use Hyperf\Swagger\Annotation\Schema;

/**
 * 快递地址信息
 */
#[Schema(title: 'CommerceAddressSchema')]
class CommerceAddressSchema implements \JsonSerializable
{
    #[Property(property: 'id', title: '主键ID', type: 'bigint')]
    public string $id;

    #[Property(property: 'user_id', title: '所属用户ID', type: 'bigint')]
    public string $user_id;

    #[Property(property: 'name', title: '姓名', type: 'varchar')]
    public string $name;

    #[Property(property: 'phone', title: '手机号码', type: 'varchar')]
    public string $phone;

    #[Property(property: 'province', title: '省', type: 'varchar')]
    public string $province;

    #[Property(property: 'city', title: '市', type: 'varchar')]
    public string $city;

    #[Property(property: 'district', title: '区', type: 'varchar')]
    public string $district;

    #[Property(property: 'address', title: '地址', type: 'varchar')]
    public string $address;

    #[Property(property: 'is_default', title: '是否默认地址：1-否，2-是', type: 'tinyint')]
    public string $is_default;

    #[Property(property: 'created_at', title: 'created_at', type: 'timestamp')]
    public string $created_at;

    #[Property(property: 'updated_at', title: 'updated_at', type: 'timestamp')]
    public string $updated_at;

    #[Property(property: 'deleted_at', title: 'deleted_at', type: 'timestamp')]
    public string $deleted_at;




    public function __construct(CommerceAddress $model)
    {
       $this->id = $model->id;
       $this->user_id = $model->user_id;
       $this->name = $model->name;
       $this->phone = $model->phone;
       $this->province = $model->province;
       $this->city = $model->city;
       $this->district = $model->district;
       $this->address = $model->address;
       $this->is_default = $model->is_default;
       $this->created_at = $model->created_at;
       $this->updated_at = $model->updated_at;
       $this->deleted_at = $model->deleted_at;

    }

    public function jsonSerialize(): array
    {
        return ['id' => $this->id ,'user_id' => $this->user_id ,'name' => $this->name ,'phone' => $this->phone ,'province' => $this->province ,'city' => $this->city ,'district' => $this->district ,'address' => $this->address ,'is_default' => $this->is_default ,'created_at' => $this->created_at ,'updated_at' => $this->updated_at ,'deleted_at' => $this->deleted_at];
    }
}